<template>
     <el-dialog v-model="dialog" :title="form.password == '' ? '添加用户' :'修改用户'">
            <el-form :model="form">
            <el-form-item label="用户名" :label-width="formLabelWidth">
                <el-input :disabled="form.password != ''" v-model="form.username" autocomplete="off" />
            </el-form-item>
            <el-form-item v-show="form.password == ''" label="密码" :label-width="formLabelWidth">
                <el-input v-model="form.password" autocomplete="off" />
            </el-form-item>
            <el-form-item label="邮箱" :label-width="formLabelWidth">
                <el-input v-model="form.email" autocomplete="off" />
            </el-form-item>
            <el-form-item label="手机" :label-width="formLabelWidth">
                <el-input v-model="form.mobile" autocomplete="off" />
            </el-form-item>
            </el-form>
            <template #footer>
            <span class="dialog-footer">
                <el-button @click="esc">取消</el-button>
                <el-button type="primary" v-if="form.password == ''" @click="add()">确定</el-button>
                <el-button type="primary" v-if="form.password != ''" @click="changed()">修改</el-button>
            </span>
            </template>
        </el-dialog>
</template>
<script setup>
import { defineProps,defineEmits } from 'vue'
//汪宇涵是你爹
const props = defineProps({
    dialog:Boolean,
    form:Object,
})
const emit = defineEmits(['esc','add','changed']);

const esc = ()=>{
    emit('esc');
}

const add = ()=>{
    emit('add')
}
const changed = ()=>{
    emit('changed')
}
</script>
<style lang="scss" scoped>
    
</style>